Skip to content

Conversation

@AndrewLuGit
Copy link
Contributor

No description provided.

@AndrewLuGit AndrewLuGit requested a review from Rocky14683 March 31, 2025 21:08
@AndrewLuGit AndrewLuGit removed the request for review from Rocky14683 March 31, 2025 21:15
@AndrewLuGit AndrewLuGit marked this pull request as draft March 31, 2025 21:17
@AndrewLuGit AndrewLuGit marked this pull request as ready for review March 31, 2025 21:17
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 25 out of 61. Check the log or trigger a new build to see more.


#include "utils/angle.hpp"
#include "utils/debug.hpp"
#include "utils/flags.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: included header debug.hpp is not used directly [misc-include-cleaner]

Suggested change
#include "utils/flags.hpp"
#include "utils/flags.hpp"


class BoomerangController : public AbstractController {
public:
enum class ThruBehavior { // affects calculation of lin_speed on thru movements
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: enum 'ThruBehavior' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size [performance-enum-size]

    enum class ThruBehavior { // affects calculation of lin_speed on thru movements
               ^

MIN_VEL, // use linear PID, but enforce a minimum velocity
FULL_SPEED // no PID, go full speed
};
enum class CosineScaling {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: enum 'CosineScaling' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size [performance-enum-size]

    enum class CosineScaling {
               ^

MIN_ERR, // only do cosine scaling within the minimum err
ALL_THE_TIME // do cosine scaling all the time
};
enum class MinErrBehavior {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: enum 'MinErrBehavior' uses a larger base type ('int', size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 byte) as the base type to reduce its size [performance-enum-size]

    enum class MinErrBehavior {
               ^


double min_vel;

ThruBehavior thru_behavior = ThruBehavior::FULL_SPEED;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: member variable 'thru_behavior' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

    ThruBehavior thru_behavior = ThruBehavior::FULL_SPEED;
                 ^

target.theta};
dx = carrotPoint.x - current_pos.x;
dy = carrotPoint.y - current_pos.y;
Point carrot_point;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: uninitialized record type: 'carrot_point' [cppcoreguidelines-pro-type-member-init]

Suggested change
Point carrot_point;
Point carrot_point{};

target.theta};
dx = carrotPoint.x - current_pos.x;
dy = carrotPoint.y - current_pos.y;
Point carrot_point;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'carrot_point' of type 'Point' can be declared 'const' [misc-const-correctness]

Suggested change
Point carrot_point;
Point const carrot_point;

dx = carrotPoint.x - current_pos.x;
dy = carrotPoint.y - current_pos.y;
Point carrot_point;
if (!reverse) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: if with identical then and else branches [bugprone-branch-clone]

    if (!reverse) {
    ^
Additional context

src/VOSS/controller/BoomerangController.cpp:36: else branch starts here

    } else {
      ^

if (thru) {
lin_speed = copysign(fmax(fabs(lin_speed), this->min_vel), lin_speed);
if (thru_behavior == ThruBehavior::FULL_SPEED) {
lin_speed = 100;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 100 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]

            lin_speed = 100;
                        ^

double ang_speed;
if (distance_error < min_error) {
this->can_reverse = true;
double pose_error = voss::norm_delta(target_angle - current_angle);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'pose_error' of type 'double' can be declared 'const' [misc-const-correctness]

Suggested change
double pose_error = voss::norm_delta(target_angle - current_angle);
double const pose_error = voss::norm_delta(target_angle - current_angle);

@AndrewLuGit AndrewLuGit merged commit ab5271f into master Apr 30, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants